package com.cc.service.iml;

import com.cc.mapper.NewsMapper;
import com.cc.model.EbNews;
import com.cc.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EbNewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper ebNewsMapper;
    @Override
    public List<EbNews> list(Integer page, Integer pageSize) {
        return ebNewsMapper.findByPage((page-1) *pageSize,pageSize);
    }
    @Override
    public int save(EbNews ebNews){
        return ebNewsMapper.save(ebNews);
    }

    @Override
    public int deleteByPk(int enId){

        return ebNewsMapper.delete(enId);
    }
    @Override
    public EbNews  selectByCondition(Integer enId){
        return ebNewsMapper.findById(enId);

    }
    @Override
    public int updateById(EbNews ebNews){

        return ebNewsMapper.UpdateBypk(ebNews);
    }
    @Override
    public int getMaxPage(int pageSize){
        return ebNewsMapper.getMaxPage(pageSize);
    }

    @Override
    public List<EbNews> findNews() {
        return ebNewsMapper.findNews();
    }


}
